-- @owner: lvlintao
-- @date: 2025-4-10
-- @testpoint:D兼容性-中括号[]包裹标识符，触发器名使用中括号包裹标识符，成功
--step1.新建表;expect:成功
@connect PrimaryDbDmode;
set d_format_behavior_compat_options='enable_sbr_identifier';
drop table if exists t_tb;
create table t_tb(id int,val varchar);
insert into t_tb values(1,'Alice'),(2,'Bob'),(3,'Calie');

--step2.创建触发器;expect:成功

create or replace function tri_f1() returns trigger as
$$
declare
begin
    delete from t_tb  where id = 4;
    return old;
end
$$ language plpgsql;
/

create trigger [Abc_abc] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [_123] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [!@#$%^_] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [[[] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [  _] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [''] before insert on t_tb
for each row execute procedure tri_f1();
/

create trigger [""] before insert on t_tb
for each row execute procedure tri_f1();
/

--step3.清理环境;expect:成功
drop trigger [Abc_abc] on t_tb;
drop trigger [_123] on t_tb;
drop trigger [!@#$%^_] on t_tb;
drop trigger [[[] on t_tb;
drop trigger [  _] on t_tb;
drop trigger [''] on t_tb;
drop trigger [""] on t_tb;
drop function if exists tri_f1();
drop table if exists t_tb;

